// // 自定义覆盖物

class CustomTextIconOverlay extends BMapLib.TextIconOverlay {
  constructor(map, { data, point, text, infoBox, icon }, opts) {
    super(point, text || '', opts);
    this.map = map;
    this.data = data || {};
    this.point = point;
    this.infoBox = infoBox || null;
    this.icon = icon || null;
  }

  getStyleByText(text, styles) {
    return styles[0];
  }

  getIcon() {
    return this.icon;
  }

  setIcon(icon) {
    this.icon = icon;
  }

  getOffset() {
    // return this.getAnchor();
    return new BMap.Size(0, 0);
  }

  getMap() {
    return this.map;
  }

  setSize(size) {
    this._styles[0].size = size;
    super._updateCss();
  }

  setAnchor(anchor) {
    this.anchor = anchor;
    super._updatePosition();
  }

  setZIndex(zIndex) {
    this._domElement && (this._domElement.style.zIndex = zIndex);
  }
}
export default CustomTextIconOverlay;
